const rule = {
    required: { required: true, message: '该字段为必填字段', pattern: /\S/ },
    PhoneNumber: { pattern: /^1(3|4|5|6|7|8|9)\d{9}$/, message: '联系电话不正确' },
    Telephone: { pattern: /^([0-9]{3,4}-)?[0-9]{7,8}$/, message: '办公电话不正确,例:0571-88888888' },
    IdCard: {
        pattern: /^[1-9][0-9]{5}([1][9][0-9]{2}|[2][0][0|1][0-9])([0][1-9]|[1][0|1|2])([0][1-9]|[1|2][0-9]|[3][0|1])[0-9]{3}([0-9]|[X])$/, message: '身份证号码不正确'
    },
    English: { pattern: /^[A-Za-z\s]*[A-Za-z\s]$/, message: '只能为纯英文' },
    Chinese: { pattern: /^[\u4E00-\u9FA5\uf900-\ufa2d·s]{2,20}$/, message: '只能为汉字' },
    Email: { pattern: /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/, message: '邮箱格式不正确' },
    RealNum: {
        whitespace: true,
        type: 'number',
        transform: (value) => {
            if (value) {
                return Number(value);
            }
        }, message: '只能为数字'
    },
    Init: { pattern: /^[1-9]\d*$/, message: '请输入大于0的正整数' },
    PostalCode: { pattern: /^[0-9]+.?[0-9]*$/, message: '邮政编码格式错误' },
    Url: {
        pattern: /[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?/, message: '格式错误'
    },
    NumberEnglishl: {
        pattern: /^[A-Za-z0-9]+$/, message: '只能为数字或英文'
    },
    PassWord: {
        pattern: /^(?![\d]+$)(?![a-zA-Z]+$)(?![^\da-zA-Z]+$).{6,14}$/, message: '密码规则不合法'
    },
    Ip: {
        pattern: /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/, message: 'IP不合法'
    }
}

export default rule